using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using Beaker.OpenCube.Render.Maths;

namespace Beaker.OpenCube.Render.Cameras
{
	public sealed class LineRenderUpdate
		: IRenderUpdate
	{
		private readonly int _lineNumber;
		private readonly Color[] _linePixels;

		internal LineRenderUpdate( int lineNumber, IEnumerable<Color> pixels )
		{
			_lineNumber = lineNumber;
			_linePixels = ( pixels ?? new Color[0] ).ToArray();
		}

		[Pure]
		public int LineNumber
		{
			get { return _lineNumber; }
		}

		[Pure]
		public IEnumerable<Color> GetPixels()
		{
			foreach( Color pixel in _linePixels )
				yield return pixel;
		}
	}
}